import os
from multiprocessing import Pool 


input_files = os.listdir("./10.llm_result")

output_dir = "./11.sub_parent"
os.makedirs(output_dir, exist_ok=True)

def exec(input,output):
    cmd = f"python 11.extrct_sub_parent.py -input {input} -output {output}"
    os.system(cmd)

tasks = []
for file in input_files:
    input_file_path = os.path.join("./10.llm_result", file)
    output_file_path = os.path.join("./11.sub_parent", file + ".json")
    tasks.append((input_file_path, output_file_path))

# for i in tasks:
#     exec(i[0], i[1])

with Pool(250) as pool:
    pool.starmap(exec, tasks)